<% self_ip = spec.networks.send(properties.networks.apps).ip -%>
net: "<%= self_ip %>"
port: <%= p("nats.port") %>
prof_port: <%= p("nats.prof_port") %>
monitor_port: <%= p("nats.monitor_port") %>

pid_file: "/var/vcap/sys/run/nats/nats.pid"

log_file: "/var/vcap/sys/log/nats/nats.log"
debug: <%= p("nats.debug") %>
trace: <%= p("nats.trace") %>

authorization {
user: "<%= p("nats.user") %>"
password: "<%= p("nats.password") %>"
timeout: <%= p("nats.authorization_timeout") %>
}

cluster {
host: "<%= self_ip %>"
port: <%= p("nats.port") + 1 %>

authorization {
user: "<%= p("nats.user") %>"
password: "<%= p("nats.password") %>"
timeout: <%= p("nats.authorization_timeout") %>
}

routes = [
<% (p("nats.machines") - [self_ip]).each do |address| -%>
    nats-route://<%= p("nats.user") %>:<%= p("nats.password") %>@<%= address %>:<%= p("nats.port") + 1 %>
<% end -%>
]
}
